import UIKit

/**
    B站：https://www.bilibili.com/video/BV144411C7Gg?p=25

    第25课 属性观察
        1. willSet
        2. didSet
 */

struct Person {
    private var array: [String] = ["swift", "ios", "macos"]
    
    subscript(index: Int) -> String {
        set(newValue) {
            print("set ", index, "-", newValue)
        }
        get {
            print("get")
            return "apple"
        }
    }
}


var p = Person()
p[100] = "heloo"

print("__get__", p[22323])
